{% extends "master.html" %}

{% block title %}Миний мэдээлэл{% endblock %}

{% block script %}
<script type="text/javascript">
function editProfile(id)
{
	window.location.href = '/save_profile?id=' + id;
}

function deleteProfile(id)
{
	window.location.href = '/delete_profile?id=' + id;
}

function editAuthor(id)
{
	window.location.href = '/save_author?id=' +id;
}

function deleteAuthor(id)
{
	window.location.href = '/delete_author?id=' + id;
}
</script>
{% endblock %}

{% block content %}
	{% if account_list %}
		{% for account in account_list %}
			<table align="center">
				<tbody>
					<tr>
						<td><center><strong><p>Миний мэдээлэл</p></strong></center></td>
					</tr>
				</tbody>
			</table>
			<table align="center">
				<tbody>
					<tr>
						<td>Нэр: </td>
						<td>{{ account.firstname }}</td>
					</tr>
					<tr>
						<td>Овог: </td>
						<td>{{ account.lastname }}</td>
					</tr>
					<tr>
						<td>Хүйс: </td>
						<td>{{ account.gender.gender }}</td>
					</tr>
					<tr>
						<td>Төрсөн огноо: </td>
						<td>{{ account.birthdate }}</td>
					</tr>
					<tr>
						<td>Утас: </td>
						<td>{{ account.phone }}</td>
					</tr>
					<tr>
						<td>И-мэйл: </td>
						<td>{{ account.email }}</td>
					</tr>
					<tr>
						<td>Улс: </td>
						<td>{{ account.country }}</td>
					</tr>
					<tr>
						<td>Хот: </td>
						<td>{{ account.city }}</td>
					</tr>
					<tr>
						<td>Хаяг: </td>
						<td>{{ account.address }}</td>
					</tr>
					<tr>
						<td>Шуудан: </td>
						<td>{{ account.postal }}</td>
					</tr>
					<tr>
						<td>Ажил мэргэжил: </td>
						<td>{{ account.occupation.occupation }}</td>
					</tr>
					<tr>
						<td></td>
						<td>
							<input type="button" value="Засах" onclick="editProfile({{ account.key.id }})" />
							<input type="button" value="Устгах" onclick="deleteProfile({{ account.key.id }})" />
						</td>
					</tr>
					{% if author_list %}
						{% for author in author_list %}
							<tr>
								<td colspan="2"><center><strong><p>Зохиогчийн мэдээлэл</p></strong></center></td>
							</tr>
							<tr>
								<td>Зураг: </td>
								<td><img src="/photo" /></td>
							</tr>
							<tr>
								<td>Дансны дугаар: </td>
								<td>{{ author.account }}</td>
							</tr>
							<tr>
								<td>Намтар: </td>
								<td>{{ author.biography }}</td>
							</tr>
							<tr>
								<td></td>
								<td>
									<input type="button" value="Засах" onclick="editAuthor({{ author.key.id }})" />
									<input type="button" value="Устгах" onclick="deleteAuthor({{ author.key.id }})" />
								</td>
							</tr>
							<tr>
								<td></td>
								<td>
									<input type="button" value="Миний номын сан" onclick="redirect(4)">
								</td>
							</tr>
						{% endfor %}
					{% else %}
						<tr>
							<td colspan="2"><center><strong><p><font color="red">Та зохиогч болохыг хүсвэл доорх товч дээр дарна уу.</font></p></strong></center></td>
						</tr>
						<tr>
							<td></td>
							<td>
								<input type="button" value="Зохиогч болох" onclick="redirect(2)" />
							</td>
						</tr>
					{% endif %}
				</tbody>
			</table>
		{% endfor %}
	{% else %}
		<table align="center">
			<tbody>
				<tr>
					<td><center><strong><p><font color="red">Та өөрийн мэдээллийг оруулаагүй байна.</font></p></strong></center></td>
				</tr>
			</tbody>
		</table>
		<table align="center">
			<tbody>
				<tr>
					<td><input type="button" value="Мэдээлэл оруулах" onclick="redirect(1)" /></td>
					<td><input type="button" value="Буцах" onclick="history.go(-1)" /></td>
				</tr>
			</tbody>
		</table>
	{% endif %}
{% endblock %}
{% block sidebar %}{% include "sidebar.html" %}{% endblock %}